home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.1 / gnugrep.1 < prev    next >
Text File  |  1995-07-25  |  11KB  |  265 lines

  1.  
  2.  
  3.  
  4.      GGGGRRRREEEEPPPP((((1111))))          GGGGNNNNUUUU PPPPrrrroooojjjjeeeecccctttt ((((1111999988888888 DDDDeeeecccceeeemmmmbbbbeeeerrrr 11113333))))           GGGGRRRREEEEPPPP((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           grep, egrep - print lines matching a regular expression
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           ggggrrrreeeepppp [ ----CCCCVVVVbbbbcccchhhhiiiillllnnnnssssvvvvwwwwxxxx ] [ ----_n_u_m ] [ ----AAAABBBB _n_u_m ] [ [ ----eeee ] _e_x_p_r |
  13.           ----ffff _f_i_l_e ] [ _f_i_l_e_s ... ]
  14.  
  15.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.           _G_r_e_p searches the files listed in the arguments (or standard
  17.           input if no files are given) for all lines that contain a
  18.           match for the given _e_x_p_r.  If any lines match, they are
  19.           printed.
  20.  
  21.           Also, if any matches were found, _g_r_e_p will exit with a
  22.           status of 0, but if no matches were found it will exit with
  23.           a status of 1.  This is useful for building shell scripts
  24.           that use _g_r_e_p as a condition for, for example, the _i_f
  25.           statement.
  26.  
  27.           When invoked as _e_g_r_e_p the syntax of the _e_x_p_r is slightly
  28.           different; See below.
  29.  
  30.      RRRREEEEGGGGUUUULLLLAAAARRRR EEEEXXXXPPPPRRRREEEESSSSSSSSIIIIOOOONNNNSSSS
  31.                (grep)    (egrep)   (explanation)
  32.  
  33.                _c         _c         a single (non-meta) character
  34.                                    matches itself.
  35.  
  36.                .         .         matches any single character except
  37.                                    newline.
  38.  
  39.                \?        ?         postfix operator; preceeding item
  40.                                    is optional.
  41.  
  42.                *         *         postfix operator; preceeding item 0
  43.                                    or more times.
  44.  
  45.                \+        +         postfix operator; preceeding item 1
  46.                                    or more times.
  47.  
  48.                \|        |         infix operator; matches either
  49.                                    argument.
  50.  
  51.                ^         ^         matches the empty string at the
  52.                                    beginning of a line.
  53.  
  54.                $         $         matches the empty string at the end
  55.                                    of a line.
  56.  
  57.                \<        \<        matches the empty string at the
  58.                                    beginning of a word.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                           (printed 3/9/94)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      GGGGRRRREEEEPPPP((((1111))))          GGGGNNNNUUUU PPPPrrrroooojjjjeeeecccctttt ((((1111999988888888 DDDDeeeecccceeeemmmmbbbbeeeerrrr 11113333))))           GGGGRRRREEEEPPPP((((1111))))
  71.  
  72.  
  73.  
  74.                \>        \>        matches the empty string at the end
  75.                                    of a word.
  76.  
  77.                [_c_h_a_r_s]   [_c_h_a_r_s]   match any character in the given
  78.                                    class; if the first character after
  79.                                    [ is ^, match any character not in
  80.                                    the given class; a range of
  81.                                    characters may be specified by
  82.                                    _f_i_r_s_t-_l_a_s_t; for example, \W (below)
  83.                                    is equivalent to the class
  84.                                    [^A-Za-z0-9]
  85.  
  86.                \( \)     ( )       parentheses are used to override
  87.                                    operator precedence.
  88.  
  89.                \_d_i_g_i_t    \_d_i_g_i_t    \_n matches a repeat of the text
  90.                                    matched earlier in the regexp by
  91.                                    the subexpression inside the nth
  92.                                    opening parenthesis.
  93.  
  94.                \         \         any special character may be
  95.                                    preceded by a backslash to match it
  96.                                    literally.
  97.  
  98.                (the following are for compatibility with GNU Emacs)
  99.  
  100.                \b        \b        matches the empty string at the
  101.                                    edge of a word.
  102.  
  103.                \B        \B        matches the empty string if not at
  104.                                    the edge of a word.
  105.  
  106.                \w        \w        matches word-constituent characters
  107.                                    (letters & digits).
  108.  
  109.                \W        \W        matches characters that are not
  110.                                    word-constituent.
  111.  
  112.           Operator precedence is (highest to lowest) ?, *, and +,
  113.           concatenation, and finally |.  All other constructs are
  114.           syntactically identical to normal characters.  For the truly
  115.           interested, the file dfa.c describes (and implements) the
  116.           exact grammar understood by the parser.
  117.  
  118.      OOOOPPPPTTTTIIIIOOOONNNNSSSS
  119.           ----AAAA _n_u_m
  120.                print <num> lines of context after every matching line
  121.  
  122.           ----BBBB _n_u_m
  123.                print _n_u_m lines of context before every matching line
  124.  
  125.           ----CCCC   print 2 lines of context on each side of every match
  126.  
  127.  
  128.  
  129.      Page 2                                           (printed 3/9/94)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      GGGGRRRREEEEPPPP((((1111))))          GGGGNNNNUUUU PPPPrrrroooojjjjeeeecccctttt ((((1111999988888888 DDDDeeeecccceeeemmmmbbbbeeeerrrr 11113333))))           GGGGRRRREEEEPPPP((((1111))))
  137.  
  138.  
  139.  
  140.           ----_n_u_m print _n_u_m lines of context on each side of every match
  141.  
  142.           ----VVVV   print the version number on the diagnostic output
  143.  
  144.           ----bbbb   print every match preceded by its byte offset
  145.  
  146.           ----cccc   print a total count of matching lines only
  147.  
  148.           ----eeee _e_x_p_r
  149.                search for _e_x_p_r; useful if _e_x_p_r begins with -
  150.  
  151.           ----ffff _f_i_l_e
  152.                search for the expression contained in _f_i_l_e
  153.  
  154.           ----hhhh   don't display filenames on matches
  155.  
  156.           ----iiii   ignore case difference when comparing strings
  157.  
  158.           ----llll   list files containing matches only
  159.  
  160.           ----nnnn   print each match preceded by its line number
  161.  
  162.           ----ssss   run silently producing no output except error messages
  163.  
  164.           ----vvvv   print only lines that contain no matches for the <expr>
  165.  
  166.           ----wwww   print only lines where the match is a complete word
  167.  
  168.           ----xxxx   print only lines where the match is a whole line
  169.  
  170.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  171.           emacs(1), ed(1), sh(1), _G_N_U _E_m_a_c_s _M_a_n_u_a_l
  172.  
  173.      IIIINNNNCCCCOOOOMMMMPPPPAAAATTTTIIIIBBBBIIIILLLLIIIITTTTIIIIEEEESSSS
  174.           The following incompatibilities with UNIX _g_r_e_p exist:
  175.  
  176.                The context-dependent meaning of * is not quite the
  177.                same (grep only).
  178.  
  179.                ----bbbb prints a byte offset instead of a block offset.
  180.  
  181.                The {_m,_n} construct of System V grep is not
  182.                implemented.
  183.  
  184.      BBBBUUUUGGGGSSSS
  185.           GNU _e?_g_r_e_p has been thoroughly debugged and tested by
  186.           several people over a period of several months; we think
  187.           it's a reliable beast or we wouldn't distribute it.  If by
  188.           some fluke of the universe you discover a bug, send a
  189.           detailed description (including options, regular
  190.           expressions, and a copy of an input file that can reproduce
  191.           it) to me, mike@wheaties.ai.mit.edu.
  192.  
  193.  
  194.  
  195.      Page 3                                           (printed 3/9/94)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      GGGGRRRREEEEPPPP((((1111))))          GGGGNNNNUUUU PPPPrrrroooojjjjeeeecccctttt ((((1111999988888888 DDDDeeeecccceeeemmmmbbbbeeeerrrr 11113333))))           GGGGRRRREEEEPPPP((((1111))))
  203.  
  204.  
  205.  
  206.           There is also a newsgroup, gnu.utils.bug, for reporting FSF
  207.           utility programs' bugs and fixes; but before reporting
  208.           something as a bug, please try to be sure that it really is
  209.           a bug, not a misunderstanding or a deliberate feature.
  210.           Also, include the version number of the utility program you
  211.           are running in _e_v_e_r_y bug report that you send in.  Please do
  212.           not send anything but bug reports to this newsgroup.
  213.  
  214.      AAAAVVVVAAAAIIIILLLLAAAABBBBIIIILLLLIIIITTTTYYYY
  215.           GNU _g_r_e_p is free; anyone may redistribute copies of _g_r_e_p to
  216.           anyone under the terms stated in the GNU General Public
  217.           License, a copy of which may be found in each copy of _G_N_U
  218.           _E_m_a_c_s.  See also the comment at the beginning of the source
  219.           code file grep.c.
  220.  
  221.           Copies of GNU _g_r_e_p may sometimes be received packaged with
  222.           distributions of Unix systems, but it is never included in
  223.           the scope of any license covering those systems.  Such
  224.           inclusion violates the terms on which distribution is
  225.           permitted.  In fact, the primary purpose of the General
  226.           Public License is to prohibit anyone from attaching any
  227.           other restrictions to redistribution of any of the Free
  228.           Software Foundation programs.
  229.  
  230.      AAAAUUUUTTTTHHHHOOOORRRRSSSS
  231.           Mike Haertel wrote the deterministic regexp code and the
  232.           bulk of the program.
  233.  
  234.           James A. Woods is responsible for the hybridized search
  235.           strategy of using Boyer-Moore-Gosper fixed-string search as
  236.           a filter before calling the general regexp matcher.
  237.  
  238.           Arthur David Olson contributed code that finds fixed strings
  239.           for the aforementioned BMG search for a large class of
  240.           regexps.
  241.  
  242.           Richard Stallman wrote the backtracking regexp matcher that
  243.           is used for \_d_i_g_i_t backreferences, as well as the getopt
  244.           that is provided for 4.2BSD sites.  The backtracking matcher
  245.           was originally written for GNU Emacs.
  246.  
  247.           D. A. Gwyn wrote the C alloca emulation that is provided so
  248.           System V machines can run this program.  (Alloca is used
  249.           only by RMS' backtracking matcher, and then only rarely, so
  250.           there is no loss if your machine doesn't have a "real"
  251.           alloca.)
  252.  
  253.           Scott Anderson and Henry Spencer designed the regression
  254.           tests used in the "regress" script.
  255.  
  256.           Paul Placeway wrote the original version of this manual
  257.           page.
  258.  
  259.  
  260.  
  261.      Page 4                                           (printed 3/9/94)
  262.  
  263.  
  264.  
  265.